#include <iostream>
//接口
class DataBase{
public:
    virtual void request() const =0;
};
class ReadDataBase:public DataBase{
public:
    virtual void request() const override{
        std::cout<<"readdatabese 处理数据"<<std::endl;
    }
};
class Proxy:public DataBase{
    DataBase* readDB;
public:
    Proxy(DataBase* p):readDB(p){}
    virtual void request() const override{
        std::cout<<"缓存处理"<<std::endl;
        readDB->request();
        std::cout<<"日志处理"<<std::endl;
    }
};
void ClientCode(DataBase& dataDB){
    dataDB.request();
}
int main() {

    ReadDataBase *RDB=new ReadDataBase;
    Proxy PXY(RDB);
   // ClientCode(PXY);
    ClientCode(*RDB);
    return 0;
}
